A menu bar icon macOS will not draw no longer quits the app - #124
Merged
Conversation
`statusItem.behavior` was `[.removalAllowed, .terminationOnRemoval]`, which reads as "dragging the icon out quits the app" and is also how macOS refusing to place the icon arrives. AppKit delivers both as the same removal, so a refusal quit the app about 180ms into launch, before any window, with no crash and nothing said. Double-clicking the app then did nothing at all. The refusal has nothing to do with the user. macOS 26 files a menu bar item under the process that launched it, so a build started once by another app inherits that app's menu bar permission for good, and a denied one leaves Nifro unlaunchable with no way to find out why. `.removalAllowed` goes with it: an icon the user can drag away from an app that no longer quits is an app with no interface and no way back. Quit is in the panel footer, and Hide menu bar icon is the setting for an icon somebody does not want.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this is
Double-clicking Nifro did nothing, and the menu bar icon was missing. Both are one thing: the app quit itself about 180ms into launch, cleanly, with no crash report and no message.
The app now stays running when macOS will not draw its icon.
Mechanism
statusItem.behaviorwas[.removalAllowed, .terminationOnRemoval]. That reads as "dragging the icon out of the menu bar quits the app", and it is also how macOS refusing to place the icon is delivered — AppKit gives both the same removal, with nothing to tell them apart.macOS 26 does not grant menu bar permission per app. It grants it per responsible process, and records it in
trackedApplicationsingroup.com.apple.controlcenter:A bundle id listed under any denied host is blocked no matter who launches it afterwards, and the app's own allowed entry does not override it. So System Settings said the icon was set to show while ControlCenter refused it on every launch:
The permission is a system record, not app state: it survives reinstalling, rebuilding, resigning and changing the bundle's path, and it is cleared only from
group.com.apple.controlcenter. Nothing in the app can see it, and there is no API that separates "the user dragged the icon away" from "the system will not place it".Scope
behavioris now[]rather than dropping only.terminationOnRemoval. Keeping.removalAllowedalone would leave an icon the user can drag away from an app that no longer quits — an app with no interface and no way back, which is worse than either half. Quit is in the panel footer, and Hide menu bar icon is the setting for an icon somebody does not want, so nothing the removal gesture offered is lost.Considered and not done: quitting only when the removal arrives after launch, on the theory that an early one is the system and a late one is the user. AppKit reports the same action either way, so the rule would be a timer standing in for a signal that does not exist, and it would still quit the app when the system revokes the permission while it runs.
Also not done: telling the user why the icon is missing. Reaching them needs a window, and the case that produces this is rare enough that a window on launch is the wrong trade. Worth reconsidering if it turns up again.
The system-side record is not the app's to write, and this change does not try to.
Verification
swift test: 221 tests in 49 suites, all passing.By hand, macOS 26.6.2 (25G83) on a Mac17,3, two displays, signed via
Tools/build-local.sh:appearsDisabledand the loading pulse both still track the scenes.